package widgets

import (
	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/dialog"
)

var confirmDialog *dialog.ConfirmDialog

func Confirm(title, msg string, w fyne.Window, fn1, fn2 func()) {
	confirmDialog = dialog.NewConfirm(title, msg, func(b bool) {
		if b {
			if fn1 != nil {
				fn1()
			}
		} else {
			if fn2 != nil {
				fn2()
			}
			return
		}
	}, w)
	confirmDialog.Show()
}
